package com.rdc.jiajiadictionary.homepage;


import com.rdc.jiajiadictionary.base.BasePresenter;
import com.rdc.jiajiadictionary.bean.DailySentence;
import com.rdc.jiajiadictionary.data.getdailysentence.DailySentenceModel;
import com.rdc.jiajiadictionary.data.getdailysentence.DailySentenceModelInterface;

public class HomePagePresenter implements BasePresenter {

    private final com.rdc.jiajiadictionary.homepage.HomePageViewInterface mHomePageViewInterface;
    private final DailySentenceModelInterface mDailySentenceModelInterface= new DailySentenceModel();

    @Override
    public void start() {
        getPicture();
    }

    public HomePagePresenter(HomePageFragment homePageFragment){
        mHomePageViewInterface = homePageFragment;
        mHomePageViewInterface.setPresenter(this);
    }

    public void getPicture(){
        mDailySentenceModelInterface.getSentenceFromApi(new DailySentenceModel.GetSentenceCallBack() {
            @Override
            public void onComplete(DailySentence dailySentence) {
                mHomePageViewInterface.setData(dailySentence.getDrawable());
            }

            @Override
            public void onDataNotAvailable() {

            }
        });
    }
}
